// 这里定义初始值
const state = {
   addressType:null,  //地址类型(send/rec)
   //下单地址
   sendAddress:null,
   recAddress:null,
   cargoItem:{
    cargo: null,
    comment: null,
    index: null
   },
   fee:null,  //订单信息
   changebook:null, //地址簿地址修改存储
   locationCity:null, //定位的城市
   fixaddress:null,
   fixtype:null,
   
   
};
const mutations = {
   changeType(state, data){  //保存地址类型
    state.addressType = data
   },
   saveAddress(state, data){  //保存地址信息
    if(data.type === 'send'){
        state.sendAddress = data             
    }else if(data.type === 'rec'){
        state.recAddress = data   
    }else if(data.type == 'clear'){
        state.recAddress = null
    }
   },
   saveCargo(state, data) {
    if(data.type == 'clear'){
      state.cargoItem = {
        cargo: null,
        comment: null,
        index: null
       }
    }else{
      state.cargoItem = data
    }
  },
  savecity(state,data){ // 保存定位
    state.locationCity = data
  },
  saveOrder(state, data){
    state.fee = data
  },
  setAddressddbook(state, data){
    state.changebook = data
  },
  setfixaddress(state,data){  // 保存错误地址问题
    state.fixaddress = data 
  },
  cheokoutaddressTyep(state,data){
    state.fixtype = data
  }
  };
const actions = {};
const getters = {};
export default {
	state,
	mutations,
	actions,
	getters
  };
